package com.nioserver.io;

import com.helper.Debug;
import com.nioserver.lib.IMessageReader;
import com.nioserver.lib.Message;
import com.nioserver.lib.MessageBuffer;
import com.nioserver.linklayer.Socket;


import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

public class DataReader implements IMessageReader {

    private MessageBuffer messageBuffer    = null;

    private List<Message> completeMessages = new ArrayList<Message>();
    WorkPool poolReader;
    public byte[] buffer;

    @Override
    public void init(MessageBuffer readMessageBuffer) {
        this.messageBuffer        = readMessageBuffer;
    }
    @Override
    public void read(Socket socket, ByteBuffer byteBuffer) throws IOException {

        socket.readAsync(byteBuffer);
    }


    @Override
    public List<Message> getMessages() {
        return this.completeMessages;
    }

}
